<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePrintersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('printers', function (Blueprint $table) {
            $table->id();
            $table->string("name",30)->default('')->comment("打印机名称");
            $table->integer("shopId")->default(0)->comment("门店ID");
            $table->integer("brandId")->default(0)->comment("品牌ID");
            $table->tinyInteger("deviceId")->default(0)->comment("装置ID  0：默认");
            $table->tinyInteger("printerType")->default(0)->comment("打印机类型  0：收银   1：后厨");
            $table->tinyInteger("deviceType")->default(0)->comment("应用类型 0：默认  1：USB   2：WIFI  3：蓝牙  4：网络");
            $table->string("printerIp", 15)->default('')->comment("打印机IP");
            $table->integer("printerPort")->default(9100)->comment("打印机端口");
            $table->tinyInteger("status")->default(0)->comment("状态,0 启用 1 未启用  2 其它状态");
            $table->tinyInteger('isDeleted')->default(0)->comment("是否删除 0：未删除，1：已删除");
            $table->integer("createdAt")->default(0)->comment("创建时间");
            $table->integer("updatedAt")->default(0)->comment("修改时间");
            $table->index("createdAt","idx_created_at");
            $table->index("shopId","idx_shopId");

            $table->collation = 'utf8mb4_general_ci';

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('printers');
    }
}
